package com.happyass.dao;

import com.happyass.pojo.Evaluate;
import com.happyass.show.entity.Activity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EvaluateDao extends PagingAndSortingRepository<Evaluate,Integer>, JpaRepository<Evaluate,Integer> {
    @Query(value = "select * from evaluate where evaluate_status= 1 ",nativeQuery=true)
    List<Evaluate> selectByStaus();

    @Query(value = "SELECT AVG(evaluate_star) from evaluate",nativeQuery=true)
    double averageStar();


    List<Evaluate> findByEvaluateStar(@Param("evaluateStar") Integer evaluateStar);
}
